<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">

img{
	width: 150px;
	height: 150px;
	margin: 50px;

	
}
h2{
text-align: center;
}

</style>
</head>
<body>
<h2>商品列表</h2>
<img src="/CookiePro/product/1.jpg"><a href="/CookiePro/product?pid=1">电冰箱</a>
<img src="/CookiePro/product/2.jpg"><a href="/CookiePro/product?pid=2">电脑</a>
<img src="/CookiePro/product/3.jpg"><a href="/CookiePro/product?pid=3">电视机</a>
<hr/>
<img src="/CookiePro/product/4.jpg"><a href="/CookiePro/product?pid=4">手机</a>
<img src="/CookiePro/product/5.jpg"><a href="/CookiePro/product?pid=5">洗衣机</a>
<img src="/CookiePro/product/6.jpg"><a href="/CookiePro/product?pid=6">monkey</a>
<hr/>
<!-- 写一个java程序 -->

<%
Cookie [] cc=request.getCookies();

Cookie product=null;
if(cc!=null){
	for(Cookie c1:cc){
		if(c1.getName().equals("product")){
			
			product=c1;
			break;
		}
	}
}

if(product==null){
	%>
	<h1>你想要的不存在</h1>
	<%
}else{
	String value=product.getValue();
	
	String [] str=value.split("-");
	
	for(String str1:str){
	%>
	<!-- 遍历输出结果 -->
	
	<img src="/CookiePro/product/<%=str1%>.jpg">
	
	<%
		
	}
	
}





%>


</body>
</html>